1 <?
2 if
(isset($_POST['butSaveLoai'])) {
3     $code=$_POST[
'code'];
4     $name=trim($_POST[
'name']);
5     $conver=$_POST[
'conver'];
6     $thutu=$_POST[
'thutu'];
7             
8     
if ($code=="")
9     {
10         echo
"<p align=center class='err'>B&#7841;n ch&#432;a nh&#7853;p Mã</p>";
11     }
12     
else
13     {
14         
if (!empty($_POST['oldid'])) {
15             $oldid = $_POST[
'oldid'];
16             $sql =
"update currency set code='".$code."', name='".$name."', conver='".$conver."', thutu=".$thutu." where id='".$oldid."'";
17         }
18         
else
19             $sql =
"insert into currency (code, name, conver, thutu) values ('".$code."','".$name."','".$conver."','".$thutu."')";
20         
if (mysql_query($sql,$con)) {
21             echo
"<p align=center class='err'>&#272;ã c&#7853;p nh&#7853;t thành công</p><br>";
22             echo
"<script>window.location='index.php?act=currency&page=".$_REQUEST['page']."'</script>";
23         }
24         
else echo "<p align=center class='err'>Không th&#7875; c&#7853;p nh&#7853;t</p>";
25     }
26 }
27 ?>
28
29 <?
30     
if (isset($_GET['id'])) {
31         $oldid=$_GET[
'id'];
32         $sql =
"select * from currency where id='".$oldid."'";
33         
if ($result = mysql_query($sql,$con)) {
34             $row=mysql_fetch_array($result);
35             $code=$row[
'code'];
36             $name=$row[
'name'];
37             $conver=$row[
'conver'];
38             $thutu=$row[
'thutu'];
39         }
40     }
41 ?>
42
43 <form method=
"POST" name="FormLoaiSP" action="index.php">
44 <input type=hidden name=
"act" value="currency_m">
45 <input type=hidden name=
"oldid" value="<? echo $oldid; ?>">
46 <input type=hidden name=
"page" value="<? echo $_REQUEST['page']; ?>">
47 <table border=
"1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
48   <tr>
49     <td width=
"45%" height="20" align="center" class="title">
50     Thêm m&#
7899;i / C&#7853;p nh&#7853;t : Currency</td>
51   </tr>
52   <tr>
53     <td width=
"45%">
54     <table border=
"0" cellpadding="4" bordercolor="#111111" width="124%" id="AutoNumber2" cellspacing="0">
55     <tr>
56         <td width=
"15%" class="smallfont">
57         <p align=
"right">Code</td>
58         <td width=
"1%" class="smallfont">
59         <font color=
"#FF0000">*</font></td>
60         <td width=
"83%" class="smallfont">
61         <INPUT
value="<? echo $code; ?>" TYPE="text" NAME="code" CLASS=textbox size="34"></td>
62       </tr>
63       <tr>
64         <td width=
"15%" class="smallfont">
65         <p align=
"right">Tên</td>
66         <td width=
"1%" class="smallfont">
67         <font color=
"#FF0000">*</font></td>
68         <td width=
"83%" class="smallfont">
69         <INPUT
value="<? echo $name; ?>" TYPE="text" NAME="name" CLASS=textbox size="34"></td>
70       </tr>
71       <tr>
72         <td width=
"15%" class="smallfont">
73         <p align=
"right">Convert</td>
74         <td width=
"1%" class="smallfont">
75         &nbsp;</td>
76         <td width=
"83%" class="smallfont">
77         <INPUT
value="<? echo $conver; ?>" TYPE="text" NAME="conver" CLASS=textbox size="34"></td>
78       </tr>
79       <tr>
80         <td width=
"15%" class="smallfont" align="right">
81         Thu tu</td>
82         <td width=
"1%" class="smallfont" align="right">
83         &nbsp;</td>
84         <td width=
"83%" class="smallfont">
85         <input type=
"text" value="<? echo $thutu; ?>" name="thutu"></td>
86       </tr>
87       <tr>
88         <td width=
"15%" class="smallfont">
89         <p align=
"right"><INPUT TYPE="submit" NAME="butSaveLoai" VALUE=" L&#432;u " CLASS=button>&nbsp;</td>
90         <td width=
"1%" class="smallfont">
91         &nbsp;</td>
92         <td width=
"83%" class="smallfont"><p align="left">&nbsp;<INPUT TYPE="reset" CLASS=button></td>
93       </tr>
94     </table>
95     </td>
96   </tr>
97   </table>
98 </form>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.857 lượt xem

Gõ tìm kiếm nhanh...